package com.elcl.widget.comp.dialog;

import android.view.View;
import android.view.ViewGroup;
import android.widget.DatePicker;

import com.elcl.util.AppUtils;

public class DateDialogUtils {

	/**
	 * @param datePicker
	 *            设置时间选择器只选择年月。
	 */
	public static void showDatePickerWithoutDay(DatePicker datePicker) {
		int SDKVersion = AppUtils.getSDKVersionNumber();// 获取系统版本
		if (datePicker != null) {
			if (SDKVersion < 11) {
				((ViewGroup) datePicker.getChildAt(0)).getChildAt(2)
						.setVisibility(View.GONE);
			}
			if (SDKVersion > 14) {
				((ViewGroup) ((ViewGroup) datePicker.getChildAt(0))
						.getChildAt(0)).getChildAt(2).setVisibility(View.GONE);
			}
		}
	}

}
